Skip to content

Documentation for DATETRUNC#10756

Open
dahfjkg wants to merge 3 commits intomendix:developmentfrom
dahfjkg:dat/datetrunc
Open

Documentation for DATETRUNC#10756
dahfjkg wants to merge 3 commits intomendix:developmentfrom
dahfjkg:dat/datetrunc

Conversation

@dahfjkg
Copy link
Contributor

@dahfjkg dahfjkg commented Feb 13, 2026

To be published with 11.9 release. Needs team review.


##### timezone

`timezone` specifies the time zone to use for truncation. This parameter is optional and defaults to the local time zone. It should be a string literal containing an IANA time zone. GMT offset time zones are not supported.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The phrase "local time zone" is used in many places, but I think it is unclear what that means. "user time zone" may be better, possibly with a link to https://docs.mendix.com/refguide/date-and-time-handling/.

{{% /alert %}}

{{% alert color="info" %}}
For the date part type `WEEK`, the result of the `DATETRUNC` function depends on the database configuration. For example, by default, the first day of the week in MS SQL Server is Sunday, which means that dates are truncated to previos Sunday if date part type `WEEK` is used.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in previo[u]s.

@basdebakker
Copy link
Member

Approved by datastorage team.

Copy link
Collaborator

@MarkvanMents MarkvanMents left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dahfjkg Hi Pavel, Looks good.
I think there is one typo - can you confirm and commit the change if it looks good? Or let me know if you aren't allowed to commit.
Otherwise looks good and ready for 11.9. Thanks for submitting the request early enough.

| `QUARTER` | `2005-07-01T00:00:00.000` |
| `MONTH` | `2005-09-01T00:00:00.000` |
| `DAY` | `2005-09-03T00:00:00.000` |
| `WEEK`* | `2005-07-29T00:00:00.000` |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

However the database is set up, I'm not sure it is going to return a date more than a week before September. I guess this should be

Suggested change
| `WEEK`* | `2005-07-29T00:00:00.000` |
| `WEEK`* | `2005-08-29T00:00:00.000` |

?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @MarkvanMents, you are correct. I pushed a fixup. Thanks for noticing this! It's easy to make a mistake in date calculations and hard to spot it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants